Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/edit task screen #63

Merged
merged 2 commits into from
Mar 28, 2024
Merged

Feature/edit task screen #63

merged 2 commits into from
Mar 28, 2024

Conversation

Bedrockdude10
Copy link
Contributor

@Bedrockdude10 Bedrockdude10 commented Mar 28, 2024

Description

Link to Ticket

Added mutations for new tasks and updating tasks. Also added bones of add new task details screen (currently disconnected)

How Has This Been Tested?

No unit tests, but basically copies structure from medication mutations.

Checklist

  • I have performed a self-review of my code
  • I have reached out to another developer to review my code
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes

Comment on lines +52 to +70
<View style={{ flex: 1, position: 'relative' }}>
<View style={{ position: 'absolute', top: '10%', left: 5, right: 5 }}>
<PopupModal isVisible={modalVisible} setVisible={setModalVisible}>
<ActivityIndicator size="large" />
<Text>Adding Task...</Text>
</PopupModal>
<Text
style={{
color: 'black',
fontSize: 24,
fontWeight: 'bold',
fontFamily: 'Inter'
}}
>
Task Details
</Text>

<View
style={{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance all of this style stuff can quickly be turned into tailwind?

Copy link
Contributor Author

@Bedrockdude10 Bedrockdude10 Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See most recent commit (literally just fed it to GPT). Can you check out the mutations? Anything u see that needs changes there?

Comment on lines +101 to +137
export const addNewTaskMutation = () => {
const queryClient = useQueryClient();

const { mutate: addTaskMutation } = useMutation({
mutationFn: (newTask: Task) => addNewTask(newTask),
onSuccess: () => {
queryClient.invalidateQueries('filteredTaskList');
},
onError: (err) => {
console.error('ERROR: Failed to Add Task. Code:', err);
}
});

return addTaskMutation;
};

export const editTaskMutation = () => {
const queryClient = useQueryClient();

const { mutate: editTaskMutation } = useMutation({
mutationFn: ({
taskId,
updatedTask
}: {
taskId: string;
updatedTask: Task;
}) => editTask(taskId, updatedTask),
onSuccess: () => {
queryClient.invalidateQueries('filteredTaskList');
},
onError: (err) => {
console.error('ERROR: Failed to Edit Task. Code:', err);
}
});

return editTaskMutation;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimistic updates maybe?

@Bedrockdude10 Bedrockdude10 merged commit fa49d2a into main Mar 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants